package com.bt.springboot.web.controller;

import com.bt.springboot.rabbitmq.DelayedMessageProducer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zkx
 * @Date 2024/6/18 18:07
 */
@Slf4j
@RestController
@RequestMapping("/delayed")
public class DelayedMessageController {

	@Autowired
	private DelayedMessageProducer delayedMessageProducer;

	@GetMapping("/send")
	public String sendDirectMessage(@RequestParam String message) {
		delayedMessageProducer.sendDelayedMessage(message);
		log.info("Delayed message sent to Exchange: " + message);
		return "Delayed message sent to Exchange: " + message;
	}
}
